using System.Web.Mvc;

namespace Sinbiota.Web.ActionFilters
{
    public class ExportMessagesToTempDataAttribute : ActionFilterAttribute
    {
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            foreach (var msg in new[] { "InformationMessage", "ErrorMessage" })
            {
                filterContext.Controller.TempData[msg] = filterContext.Controller.ViewData[msg];
            }
            base.OnActionExecuted(filterContext);
        }
    }
}